{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 上周学习内容\n",
    "* A.python的第一行代码\n",
    "* B.观察标准库\n",
    "\n",
    "### 重要学习资源：\n",
    ">[PYTHON官网](https://www.python.org/)  \n",
    ">[博客园blogs](https://cnblogs.com/xuzhichao)  \n",
    ">[官方英文新手教程](https://www.python.org/doc/)\n",
    "\n",
    "## 本周学习内容\n",
    "* A.[pycharm](https://www.jetbrains.com/pycharm/)下载安装\n",
    "> a.项目管理类的IDE  \n",
    "> b.[github eduacation pack](https://education.github.com/pack)可获取免费一年 专业版使用\n",
    "* B.[jupyter notebook](https://jupyter.org/)安装学习\n",
    "> a.在官网尝试体验，并对juypter具体介绍  \n",
    "> b.如何通过cmd中直接执行jupyter notebook（在个人电脑中打开）  \n",
    "> c.如何利用jupyter notebook进行代码系统管理，每周进行笔记的整理归纳\n",
    "\n",
    "### 变量、赋值、数据\n",
    "* 变量定义的规则\n",
    "> a.变量名只能是 字母、数字或下划线的任意组合  \n",
    "> b.变量名的第一个字符不能是数字  \n",
    "> c.以下关键字不能声明为变量名  \n",
    "['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda','not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']\n",
    "\n",
    "* 变量的赋值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hongfen Hongfen\n",
      "What is the value of name2 now?\n"
     ]
    }
   ],
   "source": [
    "name = \"Hongfen\"\n",
    "\n",
    "name2 = name\n",
    "print(name,name2)\n",
    "\n",
    "name = \"jinsheng\"\n",
    "\n",
    "print(\"What is the value of name2 now?\")\n",
    "\n",
    "#【结论】：该案例再次证明python是解释性语言，我们赋的是值，而不是变量。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 观察标准库\n",
    "* 课本练习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# os模块 提供平台独立的方式与底层操作系统交互\n",
    "from os import getcwd\n",
    "where_am_I = getcwd()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'win32'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# sys模块 了解运行解释器的系统\n",
    "import sys\n",
    "sys.platform"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.8.3 (default, Jul  2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]\n"
     ]
    }
   ],
   "source": [
    "# 确定系统Python运行版本\n",
    "print(sys.version)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'C:\\\\Users\\\\86136\\\\Desktop\\\\Python（重修）\\\\Me_notebook\\\\jyputer_projects\\\\week01'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 得出代码所在文件夹的名称\n",
    "import os\n",
    "os.getcwd()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "environ{'ALLUSERSPROFILE': 'C:\\\\ProgramData',\n",
       "        'ANDROID_SDK_HOME': 'C:\\\\Android',\n",
       "        'APPDATA': 'C:\\\\Users\\\\86136\\\\AppData\\\\Roaming',\n",
       "        'COMMONPROGRAMFILES': 'C:\\\\Program Files\\\\Common Files',\n",
       "        'COMMONPROGRAMFILES(X86)': 'C:\\\\Program Files (x86)\\\\Common Files',\n",
       "        'COMMONPROGRAMW6432': 'C:\\\\Program Files\\\\Common Files',\n",
       "        'COMPUTERNAME': 'LAPTOP-CHNLQR4R',\n",
       "        'COMSPEC': 'C:\\\\WINDOWS\\\\system32\\\\cmd.exe',\n",
       "        'CONDA_DEFAULT_ENV': 'base',\n",
       "        'CONDA_EXE': 'C:\\\\Users\\\\86136\\\\anaconda3\\\\Scripts\\\\conda.exe',\n",
       "        'CONDA_PROMPT_MODIFIER': '(base) ',\n",
       "        'CONDA_PYTHON_EXE': 'C:\\\\Users\\\\86136\\\\anaconda3\\\\python.exe',\n",
       "        'CONDA_ROOT': 'C:\\\\Users\\\\86136\\\\anaconda3',\n",
       "        'CONDA_SHLVL': '1',\n",
       "        'DRIVERDATA': 'C:\\\\Windows\\\\System32\\\\Drivers\\\\DriverData',\n",
       "        'FPS_BROWSER_APP_PROFILE_STRING': 'Internet Explorer',\n",
       "        'FPS_BROWSER_USER_PROFILE_STRING': 'Default',\n",
       "        'HOMEDRIVE': 'C:',\n",
       "        'HOMEPATH': '\\\\Users\\\\86136',\n",
       "        'LOCALAPPDATA': 'C:\\\\Users\\\\86136\\\\AppData\\\\Local',\n",
       "        'LOGONSERVER': '\\\\\\\\LAPTOP-CHNLQR4R',\n",
       "        'MOZ_PLUGIN_PATH': 'C:\\\\Program Files (x86)\\\\Foxit Software\\\\Foxit PhantomPDF\\\\plugins\\\\',\n",
       "        'NUMBER_OF_PROCESSORS': '8',\n",
       "        'ONEDRIVE': 'D:\\\\One Drive文件夹（备份office家族文件）\\\\OneDrive',\n",
       "        'OS': 'Windows_NT',\n",
       "        'PATH': 'C:\\\\Users\\\\86136\\\\anaconda3;C:\\\\Users\\\\86136\\\\anaconda3\\\\Library\\\\mingw-w64\\\\bin;C:\\\\Users\\\\86136\\\\anaconda3\\\\Library\\\\usr\\\\bin;C:\\\\Users\\\\86136\\\\anaconda3\\\\Library\\\\bin;C:\\\\Users\\\\86136\\\\anaconda3\\\\Scripts;C:\\\\Users\\\\86136\\\\anaconda3\\\\bin;C:\\\\Users\\\\86136\\\\anaconda3\\\\condabin;C:\\\\Users\\\\86136\\\\anaconda3;C:\\\\Users\\\\86136\\\\anaconda3\\\\Library\\\\mingw-w64\\\\bin;C:\\\\Users\\\\86136\\\\anaconda3\\\\Library\\\\usr\\\\bin;C:\\\\Users\\\\86136\\\\anaconda3\\\\Library\\\\bin;C:\\\\Users\\\\86136\\\\anaconda3\\\\Scripts;C:\\\\Windows\\\\system32;C:\\\\Windows;C:\\\\Windows\\\\System32\\\\Wbem;C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0;C:\\\\Windows\\\\System32\\\\OpenSSH;C:\\\\Program Files\\\\NVIDIA Corporation\\\\NVIDIA NvDLISR;C:\\\\Android;C:\\\\WINDOWS\\\\System32\\\\Wbem;C:\\\\Users\\\\86136\\\\anaconda3;C:\\\\Users\\\\86136\\\\anaconda3\\\\Library\\\\mingw-w64\\\\bin;C:\\\\Users\\\\86136\\\\anaconda3\\\\Library\\\\bin;C:\\\\Users\\\\86136\\\\anaconda3\\\\Scripts;.;C:\\\\WINDOWS\\\\system32;C:\\\\WINDOWS;C:\\\\WINDOWS\\\\System32\\\\WindowsPowerShell\\\\v1.0;C:\\\\WINDOWS\\\\System32\\\\OpenSSH;C:\\\\Users\\\\86136\\\\AppData\\\\Local\\\\Microsoft\\\\WindowsApps;C:\\\\Users\\\\86136\\\\AppData\\\\Local\\\\GitHubDesktop\\\\bin;D:\\\\鐢佃剳杞\\ue219欢瀹夎\\ue5ca鍖匼PyCharm2020\\\\PyCharm 2020.1\\\\bin;C:\\\\Users\\\\86136\\\\AppData\\\\Local\\\\Microsoft\\\\WindowsApps',\n",
       "        'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',\n",
       "        'PROCESSOR_ARCHITECTURE': 'AMD64',\n",
       "        'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 142 Stepping 12, GenuineIntel',\n",
       "        'PROCESSOR_LEVEL': '6',\n",
       "        'PROCESSOR_REVISION': '8e0c',\n",
       "        'PROGRAMDATA': 'C:\\\\ProgramData',\n",
       "        'PROGRAMFILES': 'C:\\\\Program Files',\n",
       "        'PROGRAMFILES(X86)': 'C:\\\\Program Files (x86)',\n",
       "        'PROGRAMW6432': 'C:\\\\Program Files',\n",
       "        'PROMPT': '(base) $P$G',\n",
       "        'PSMODULEPATH': '%ProgramFiles%\\\\WindowsPowerShell\\\\Modules;C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\Modules',\n",
       "        'PUBLIC': 'C:\\\\Users\\\\Public',\n",
       "        'PYCHARM': 'D:\\\\电脑软件安装包\\\\PyCharm2020\\\\PyCharm 2020.1\\\\bin;',\n",
       "        'SESSIONNAME': 'Console',\n",
       "        'SYSTEMDRIVE': 'C:',\n",
       "        'SYSTEMROOT': 'C:\\\\WINDOWS',\n",
       "        'TEMP': 'C:\\\\Users\\\\86136\\\\AppData\\\\Local\\\\Temp',\n",
       "        'TMP': 'C:\\\\Users\\\\86136\\\\AppData\\\\Local\\\\Temp',\n",
       "        'USERDOMAIN': 'LAPTOP-CHNLQR4R',\n",
       "        'USERDOMAIN_ROAMINGPROFILE': 'LAPTOP-CHNLQR4R',\n",
       "        'USERNAME': '86136',\n",
       "        'USERPROFILE': 'C:\\\\Users\\\\86136',\n",
       "        'WINDIR': 'C:\\\\WINDOWS',\n",
       "        'WXDRIVE_START_ARGS': '--wxdrive-setting=0 --disable-gpu --disable-software-rasterizer --enable-features=NetworkServiceInProcess',\n",
       "        'CONDA_PREFIX': 'C:\\\\Users\\\\86136\\\\anaconda3',\n",
       "        'KERNEL_LAUNCH_TIMEOUT': '40',\n",
       "        'JPY_INTERRUPT_EVENT': '1408',\n",
       "        'IPY_INTERRUPT_EVENT': '1408',\n",
       "        'JPY_PARENT_PID': '2276',\n",
       "        'TERM': 'xterm-color',\n",
       "        'CLICOLOR': '1',\n",
       "        'PAGER': 'cat',\n",
       "        'GIT_PAGER': 'cat',\n",
       "        'MPLBACKEND': 'module://ipykernel.pylab.backend_inline'}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 访问系统的全部环境变量\n",
    "os.environ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2021, 10, 9)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# datetime模块  处理日期（和时间）\n",
    "# 访问今天的日期\n",
    "import datetime\n",
    "datetime.date.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 单独访问年月日\n",
    "datetime.date.today().day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datetime.date.today().month"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2021"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datetime.date.today().year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2021-10-09'"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 将当日的日期转换为一个字符串\n",
    "import datetime\n",
    "datetime.date.isoformat(datetime.date.today())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'04:16'"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 调用strftime函数\n",
    "import time\n",
    "time.strftime(\"%H:%M\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Saturday AM'"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 对strftime函数使用%A %P规范\n",
    "time.strftime(\"%A %p\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'This HTML fragment contains a &lt;script&gt;script&lt;/script&gt; tag.'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运用unescape函数\n",
    "import html\n",
    "html.escape(\"This HTML fragment contains a <script>script</script> tag.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"I ♥ Python's <standard library>.\""
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    " html.unescape(\"I ♥ Python's <standard library>.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### if else条件判断\n",
    "* 课本练习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "odds = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19,\n",
    "        21, 23, 25, 27, 29, 31, 33, 35, 37, 39,\n",
    "        41, 43, 45, 47, 49, 51, 53, 55, 57, 59]\n",
    "\n",
    "right_this__minute = datetime.today().minute\n",
    "\n",
    "if right_this__minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 循环嵌套 练习if elif P18\n",
    "* 课本练习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'today' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-28-9c4a2e374030>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mif\u001b[0m \u001b[0mtoday\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m\"Saturday\"\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      2\u001b[0m     \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Party!\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      3\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mtoday\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m\"Sunday\"\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      4\u001b[0m     \u001b[1;32mif\u001b[0m \u001b[0mcondition\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m\"Headache\"\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m         \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Recover, then rest.\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNameError\u001b[0m: name 'today' is not defined"
     ]
    }
   ],
   "source": [
    "if today == \"Saturday\":\n",
    "    print(\"Party!\")\n",
    "elif today == \"Sunday\":\n",
    "    if condition == \"Headache\":\n",
    "        print(\"Recover, then rest.\")\n",
    "    else:\n",
    "        print(\"Rest.\")\n",
    "else:\n",
    "    print(\"Work, work, work.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### for 循环 内置函数range()\n",
    "* 课本练习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "# 循环迭代数字变量\n",
    "for i in [1,2,3]:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "H\n",
      "i\n",
      "!\n"
     ]
    }
   ],
   "source": [
    "# 循环迭代字符串变量\n",
    "for ch in \"Hi!\":\n",
    "     print(ch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n"
     ]
    }
   ],
   "source": [
    "# 迭代指定的次数\n",
    "for num in range(5):\n",
    "    print('Head First Rocks!')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用“dir”查询一个对象\n",
    "* 课本练习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['BPF',\n",
       " 'LOG4',\n",
       " 'NV_MAGICCONST',\n",
       " 'RECIP_BPF',\n",
       " 'Random',\n",
       " 'SG_MAGICCONST',\n",
       " 'SystemRandom',\n",
       " 'TWOPI',\n",
       " '_Sequence',\n",
       " '_Set',\n",
       " '__all__',\n",
       " '__builtins__',\n",
       " '__cached__',\n",
       " '__doc__',\n",
       " '__file__',\n",
       " '__loader__',\n",
       " '__name__',\n",
       " '__package__',\n",
       " '__spec__',\n",
       " '_accumulate',\n",
       " '_acos',\n",
       " '_bisect',\n",
       " '_ceil',\n",
       " '_cos',\n",
       " '_e',\n",
       " '_exp',\n",
       " '_inst',\n",
       " '_log',\n",
       " '_os',\n",
       " '_pi',\n",
       " '_random',\n",
       " '_repeat',\n",
       " '_sha512',\n",
       " '_sin',\n",
       " '_sqrt',\n",
       " '_test',\n",
       " '_test_generator',\n",
       " '_urandom',\n",
       " '_warn',\n",
       " 'betavariate',\n",
       " 'choice',\n",
       " 'choices',\n",
       " 'expovariate',\n",
       " 'gammavariate',\n",
       " 'gauss',\n",
       " 'getrandbits',\n",
       " 'getstate',\n",
       " 'lognormvariate',\n",
       " 'normalvariate',\n",
       " 'paretovariate',\n",
       " 'randint',\n",
       " 'random',\n",
       " 'randrange',\n",
       " 'sample',\n",
       " 'seed',\n",
       " 'setstate',\n",
       " 'shuffle',\n",
       " 'triangular',\n",
       " 'uniform',\n",
       " 'vonmisesvariate',\n",
       " 'weibullvariate']"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import random\n",
    "dir(random)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用“help”读取Python文档\n",
    "* 课本练习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on module random:\n",
      "\n",
      "NAME\n",
      "    random - Random variable generators.\n",
      "\n",
      "MODULE REFERENCE\n",
      "    https://docs.python.org/3.8/library/random\n",
      "    \n",
      "    The following documentation is automatically generated from the Python\n",
      "    source files.  It may be incomplete, incorrect or include features that\n",
      "    are considered implementation detail and may vary between Python\n",
      "    implementations.  When in doubt, consult the module reference at the\n",
      "    location listed above.\n",
      "\n",
      "DESCRIPTION\n",
      "        integers\n",
      "        --------\n",
      "               uniform within range\n",
      "    \n",
      "        sequences\n",
      "        ---------\n",
      "               pick random element\n",
      "               pick random sample\n",
      "               pick weighted random sample\n",
      "               generate random permutation\n",
      "    \n",
      "        distributions on the real line:\n",
      "        ------------------------------\n",
      "               uniform\n",
      "               triangular\n",
      "               normal (Gaussian)\n",
      "               lognormal\n",
      "               negative exponential\n",
      "               gamma\n",
      "               beta\n",
      "               pareto\n",
      "               Weibull\n",
      "    \n",
      "        distributions on the circle (angles 0 to 2pi)\n",
      "        ---------------------------------------------\n",
      "               circular uniform\n",
      "               von Mises\n",
      "    \n",
      "    General notes on the underlying Mersenne Twister core generator:\n",
      "    \n",
      "    * The period is 2**19937-1.\n",
      "    * It is one of the most extensively tested generators in existence.\n",
      "    * The random() method is implemented in C, executes in a single Python step,\n",
      "      and is, therefore, threadsafe.\n",
      "\n",
      "CLASSES\n",
      "    _random.Random(builtins.object)\n",
      "        Random\n",
      "            SystemRandom\n",
      "    \n",
      "    class Random(_random.Random)\n",
      "     |  Random(x=None)\n",
      "     |  \n",
      "     |  Random number generator base class used by bound module functions.\n",
      "     |  \n",
      "     |  Used to instantiate instances of Random to get generators that don't\n",
      "     |  share state.\n",
      "     |  \n",
      "     |  Class Random can also be subclassed if you want to use a different basic\n",
      "     |  generator of your own devising: in that case, override the following\n",
      "     |  methods:  random(), seed(), getstate(), and setstate().\n",
      "     |  Optionally, implement a getrandbits() method so that randrange()\n",
      "     |  can cover arbitrarily large ranges.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      Random\n",
      "     |      _random.Random\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __getstate__(self)\n",
      "     |      # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n",
      "     |      # longer called; we leave it here because it has been here since random was\n",
      "     |      # rewritten back in 2001 and why risk breaking something.\n",
      "     |  \n",
      "     |  __init__(self, x=None)\n",
      "     |      Initialize an instance.\n",
      "     |      \n",
      "     |      Optional argument x controls seeding, as for Random.seed().\n",
      "     |  \n",
      "     |  __reduce__(self)\n",
      "     |      Helper for pickle.\n",
      "     |  \n",
      "     |  __setstate__(self, state)\n",
      "     |  \n",
      "     |  betavariate(self, alpha, beta)\n",
      "     |      Beta distribution.\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      Returned values range between 0 and 1.\n",
      "     |  \n",
      "     |  choice(self, seq)\n",
      "     |      Choose a random element from a non-empty sequence.\n",
      "     |  \n",
      "     |  choices(self, population, weights=None, *, cum_weights=None, k=1)\n",
      "     |      Return a k sized list of population elements chosen with replacement.\n",
      "     |      \n",
      "     |      If the relative weights or cumulative weights are not specified,\n",
      "     |      the selections are made with equal probability.\n",
      "     |  \n",
      "     |  expovariate(self, lambd)\n",
      "     |      Exponential distribution.\n",
      "     |      \n",
      "     |      lambd is 1.0 divided by the desired mean.  It should be\n",
      "     |      nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "     |      a reserved word in Python.)  Returned values range from 0 to\n",
      "     |      positive infinity if lambd is positive, and from negative\n",
      "     |      infinity to 0 if lambd is negative.\n",
      "     |  \n",
      "     |  gammavariate(self, alpha, beta)\n",
      "     |      Gamma distribution.  Not the gamma function!\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      \n",
      "     |      The probability distribution function is:\n",
      "     |      \n",
      "     |                  x ** (alpha - 1) * math.exp(-x / beta)\n",
      "     |        pdf(x) =  --------------------------------------\n",
      "     |                    math.gamma(alpha) * beta ** alpha\n",
      "     |  \n",
      "     |  gauss(self, mu, sigma)\n",
      "     |      Gaussian distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.  This is\n",
      "     |      slightly faster than the normalvariate() function.\n",
      "     |      \n",
      "     |      Not thread-safe without a lock around calls.\n",
      "     |  \n",
      "     |  getstate(self)\n",
      "     |      Return internal state; can be passed to setstate() later.\n",
      "     |  \n",
      "     |  lognormvariate(self, mu, sigma)\n",
      "     |      Log normal distribution.\n",
      "     |      \n",
      "     |      If you take the natural logarithm of this distribution, you'll get a\n",
      "     |      normal distribution with mean mu and standard deviation sigma.\n",
      "     |      mu can have any value, and sigma must be greater than zero.\n",
      "     |  \n",
      "     |  normalvariate(self, mu, sigma)\n",
      "     |      Normal distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.\n",
      "     |  \n",
      "     |  paretovariate(self, alpha)\n",
      "     |      Pareto distribution.  alpha is the shape parameter.\n",
      "     |  \n",
      "     |  randint(self, a, b)\n",
      "     |      Return random integer in range [a, b], including both end points.\n",
      "     |  \n",
      "     |  randrange(self, start, stop=None, step=1, _int=<class 'int'>)\n",
      "     |      Choose a random item from range(start, stop[, step]).\n",
      "     |      \n",
      "     |      This fixes the problem with randint() which includes the\n",
      "     |      endpoint; in Python this is usually not what you want.\n",
      "     |  \n",
      "     |  sample(self, population, k)\n",
      "     |      Chooses k unique random elements from a population sequence or set.\n",
      "     |      \n",
      "     |      Returns a new list containing elements from the population while\n",
      "     |      leaving the original population unchanged.  The resulting list is\n",
      "     |      in selection order so that all sub-slices will also be valid random\n",
      "     |      samples.  This allows raffle winners (the sample) to be partitioned\n",
      "     |      into grand prize and second place winners (the subslices).\n",
      "     |      \n",
      "     |      Members of the population need not be hashable or unique.  If the\n",
      "     |      population contains repeats, then each occurrence is a possible\n",
      "     |      selection in the sample.\n",
      "     |      \n",
      "     |      To choose a sample in a range of integers, use range as an argument.\n",
      "     |      This is especially fast and space efficient for sampling from a\n",
      "     |      large population:   sample(range(10000000), 60)\n",
      "     |  \n",
      "     |  seed(self, a=None, version=2)\n",
      "     |      Initialize internal state from hashable object.\n",
      "     |      \n",
      "     |      None or no argument seeds from current time or from an operating\n",
      "     |      system specific randomness source if available.\n",
      "     |      \n",
      "     |      If *a* is an int, all bits are used.\n",
      "     |      \n",
      "     |      For version 2 (the default), all of the bits are used if *a* is a str,\n",
      "     |      bytes, or bytearray.  For version 1 (provided for reproducing random\n",
      "     |      sequences from older versions of Python), the algorithm for str and\n",
      "     |      bytes generates a narrower range of seeds.\n",
      "     |  \n",
      "     |  setstate(self, state)\n",
      "     |      Restore internal state from object returned by getstate().\n",
      "     |  \n",
      "     |  shuffle(self, x, random=None)\n",
      "     |      Shuffle list x in place, and return None.\n",
      "     |      \n",
      "     |      Optional argument random is a 0-argument function returning a\n",
      "     |      random float in [0.0, 1.0); if it is the default None, the\n",
      "     |      standard random.random will be used.\n",
      "     |  \n",
      "     |  triangular(self, low=0.0, high=1.0, mode=None)\n",
      "     |      Triangular distribution.\n",
      "     |      \n",
      "     |      Continuous distribution bounded by given lower and upper limits,\n",
      "     |      and having a given mode value in-between.\n",
      "     |      \n",
      "     |      http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "     |  \n",
      "     |  uniform(self, a, b)\n",
      "     |      Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "     |  \n",
      "     |  vonmisesvariate(self, mu, kappa)\n",
      "     |      Circular data distribution.\n",
      "     |      \n",
      "     |      mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "     |      kappa is the concentration parameter, which must be greater than or\n",
      "     |      equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "     |      to a uniform random angle over the range 0 to 2*pi.\n",
      "     |  \n",
      "     |  weibullvariate(self, alpha, beta)\n",
      "     |      Weibull distribution.\n",
      "     |      \n",
      "     |      alpha is the scale parameter and beta is the shape parameter.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods defined here:\n",
      "     |  \n",
      "     |  __init_subclass__(**kwargs) from builtins.type\n",
      "     |      Control how subclasses generate random integers.\n",
      "     |      \n",
      "     |      The algorithm a subclass can use depends on the random() and/or\n",
      "     |      getrandbits() implementation available to it and determines\n",
      "     |      whether it can generate random integers from arbitrarily large\n",
      "     |      ranges.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  VERSION = 3\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  getrandbits(self, k, /)\n",
      "     |      getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "     |  \n",
      "     |  random(self, /)\n",
      "     |      random() -> x in the interval [0, 1).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "    \n",
      "    class SystemRandom(Random)\n",
      "     |  SystemRandom(x=None)\n",
      "     |  \n",
      "     |  Alternate random number generator using sources provided\n",
      "     |  by the operating system (such as /dev/urandom on Unix or\n",
      "     |  CryptGenRandom on Windows).\n",
      "     |  \n",
      "     |   Not available on all systems (see os.urandom() for details).\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      SystemRandom\n",
      "     |      Random\n",
      "     |      _random.Random\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  getrandbits(self, k)\n",
      "     |      getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "     |  \n",
      "     |  getstate = _notimplemented(self, *args, **kwds)\n",
      "     |  \n",
      "     |  random(self)\n",
      "     |      Get the next random number in the range [0.0, 1.0).\n",
      "     |  \n",
      "     |  seed(self, *args, **kwds)\n",
      "     |      Stub method.  Not used for a system random number generator.\n",
      "     |  \n",
      "     |  setstate = _notimplemented(self, *args, **kwds)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from Random:\n",
      "     |  \n",
      "     |  __getstate__(self)\n",
      "     |      # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n",
      "     |      # longer called; we leave it here because it has been here since random was\n",
      "     |      # rewritten back in 2001 and why risk breaking something.\n",
      "     |  \n",
      "     |  __init__(self, x=None)\n",
      "     |      Initialize an instance.\n",
      "     |      \n",
      "     |      Optional argument x controls seeding, as for Random.seed().\n",
      "     |  \n",
      "     |  __reduce__(self)\n",
      "     |      Helper for pickle.\n",
      "     |  \n",
      "     |  __setstate__(self, state)\n",
      "     |  \n",
      "     |  betavariate(self, alpha, beta)\n",
      "     |      Beta distribution.\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      Returned values range between 0 and 1.\n",
      "     |  \n",
      "     |  choice(self, seq)\n",
      "     |      Choose a random element from a non-empty sequence.\n",
      "     |  \n",
      "     |  choices(self, population, weights=None, *, cum_weights=None, k=1)\n",
      "     |      Return a k sized list of population elements chosen with replacement.\n",
      "     |      \n",
      "     |      If the relative weights or cumulative weights are not specified,\n",
      "     |      the selections are made with equal probability.\n",
      "     |  \n",
      "     |  expovariate(self, lambd)\n",
      "     |      Exponential distribution.\n",
      "     |      \n",
      "     |      lambd is 1.0 divided by the desired mean.  It should be\n",
      "     |      nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "     |      a reserved word in Python.)  Returned values range from 0 to\n",
      "     |      positive infinity if lambd is positive, and from negative\n",
      "     |      infinity to 0 if lambd is negative.\n",
      "     |  \n",
      "     |  gammavariate(self, alpha, beta)\n",
      "     |      Gamma distribution.  Not the gamma function!\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      \n",
      "     |      The probability distribution function is:\n",
      "     |      \n",
      "     |                  x ** (alpha - 1) * math.exp(-x / beta)\n",
      "     |        pdf(x) =  --------------------------------------\n",
      "     |                    math.gamma(alpha) * beta ** alpha\n",
      "     |  \n",
      "     |  gauss(self, mu, sigma)\n",
      "     |      Gaussian distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.  This is\n",
      "     |      slightly faster than the normalvariate() function.\n",
      "     |      \n",
      "     |      Not thread-safe without a lock around calls.\n",
      "     |  \n",
      "     |  lognormvariate(self, mu, sigma)\n",
      "     |      Log normal distribution.\n",
      "     |      \n",
      "     |      If you take the natural logarithm of this distribution, you'll get a\n",
      "     |      normal distribution with mean mu and standard deviation sigma.\n",
      "     |      mu can have any value, and sigma must be greater than zero.\n",
      "     |  \n",
      "     |  normalvariate(self, mu, sigma)\n",
      "     |      Normal distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.\n",
      "     |  \n",
      "     |  paretovariate(self, alpha)\n",
      "     |      Pareto distribution.  alpha is the shape parameter.\n",
      "     |  \n",
      "     |  randint(self, a, b)\n",
      "     |      Return random integer in range [a, b], including both end points.\n",
      "     |  \n",
      "     |  randrange(self, start, stop=None, step=1, _int=<class 'int'>)\n",
      "     |      Choose a random item from range(start, stop[, step]).\n",
      "     |      \n",
      "     |      This fixes the problem with randint() which includes the\n",
      "     |      endpoint; in Python this is usually not what you want.\n",
      "     |  \n",
      "     |  sample(self, population, k)\n",
      "     |      Chooses k unique random elements from a population sequence or set.\n",
      "     |      \n",
      "     |      Returns a new list containing elements from the population while\n",
      "     |      leaving the original population unchanged.  The resulting list is\n",
      "     |      in selection order so that all sub-slices will also be valid random\n",
      "     |      samples.  This allows raffle winners (the sample) to be partitioned\n",
      "     |      into grand prize and second place winners (the subslices).\n",
      "     |      \n",
      "     |      Members of the population need not be hashable or unique.  If the\n",
      "     |      population contains repeats, then each occurrence is a possible\n",
      "     |      selection in the sample.\n",
      "     |      \n",
      "     |      To choose a sample in a range of integers, use range as an argument.\n",
      "     |      This is especially fast and space efficient for sampling from a\n",
      "     |      large population:   sample(range(10000000), 60)\n",
      "     |  \n",
      "     |  shuffle(self, x, random=None)\n",
      "     |      Shuffle list x in place, and return None.\n",
      "     |      \n",
      "     |      Optional argument random is a 0-argument function returning a\n",
      "     |      random float in [0.0, 1.0); if it is the default None, the\n",
      "     |      standard random.random will be used.\n",
      "     |  \n",
      "     |  triangular(self, low=0.0, high=1.0, mode=None)\n",
      "     |      Triangular distribution.\n",
      "     |      \n",
      "     |      Continuous distribution bounded by given lower and upper limits,\n",
      "     |      and having a given mode value in-between.\n",
      "     |      \n",
      "     |      http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "     |  \n",
      "     |  uniform(self, a, b)\n",
      "     |      Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "     |  \n",
      "     |  vonmisesvariate(self, mu, kappa)\n",
      "     |      Circular data distribution.\n",
      "     |      \n",
      "     |      mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "     |      kappa is the concentration parameter, which must be greater than or\n",
      "     |      equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "     |      to a uniform random angle over the range 0 to 2*pi.\n",
      "     |  \n",
      "     |  weibullvariate(self, alpha, beta)\n",
      "     |      Weibull distribution.\n",
      "     |      \n",
      "     |      alpha is the scale parameter and beta is the shape parameter.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods inherited from Random:\n",
      "     |  \n",
      "     |  __init_subclass__(**kwargs) from builtins.type\n",
      "     |      Control how subclasses generate random integers.\n",
      "     |      \n",
      "     |      The algorithm a subclass can use depends on the random() and/or\n",
      "     |      getrandbits() implementation available to it and determines\n",
      "     |      whether it can generate random integers from arbitrarily large\n",
      "     |      ranges.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors inherited from Random:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes inherited from Random:\n",
      "     |  \n",
      "     |  VERSION = 3\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "\n",
      "FUNCTIONS\n",
      "    betavariate(alpha, beta) method of Random instance\n",
      "        Beta distribution.\n",
      "        \n",
      "        Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "        Returned values range between 0 and 1.\n",
      "    \n",
      "    choice(seq) method of Random instance\n",
      "        Choose a random element from a non-empty sequence.\n",
      "    \n",
      "    choices(population, weights=None, *, cum_weights=None, k=1) method of Random instance\n",
      "        Return a k sized list of population elements chosen with replacement.\n",
      "        \n",
      "        If the relative weights or cumulative weights are not specified,\n",
      "        the selections are made with equal probability.\n",
      "    \n",
      "    expovariate(lambd) method of Random instance\n",
      "        Exponential distribution.\n",
      "        \n",
      "        lambd is 1.0 divided by the desired mean.  It should be\n",
      "        nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "        a reserved word in Python.)  Returned values range from 0 to\n",
      "        positive infinity if lambd is positive, and from negative\n",
      "        infinity to 0 if lambd is negative.\n",
      "    \n",
      "    gammavariate(alpha, beta) method of Random instance\n",
      "        Gamma distribution.  Not the gamma function!\n",
      "        \n",
      "        Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "        \n",
      "        The probability distribution function is:\n",
      "        \n",
      "                    x ** (alpha - 1) * math.exp(-x / beta)\n",
      "          pdf(x) =  --------------------------------------\n",
      "                      math.gamma(alpha) * beta ** alpha\n",
      "    \n",
      "    gauss(mu, sigma) method of Random instance\n",
      "        Gaussian distribution.\n",
      "        \n",
      "        mu is the mean, and sigma is the standard deviation.  This is\n",
      "        slightly faster than the normalvariate() function.\n",
      "        \n",
      "        Not thread-safe without a lock around calls.\n",
      "    \n",
      "    getrandbits(k, /) method of Random instance\n",
      "        getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "    \n",
      "    getstate() method of Random instance\n",
      "        Return internal state; can be passed to setstate() later.\n",
      "    \n",
      "    lognormvariate(mu, sigma) method of Random instance\n",
      "        Log normal distribution.\n",
      "        \n",
      "        If you take the natural logarithm of this distribution, you'll get a\n",
      "        normal distribution with mean mu and standard deviation sigma.\n",
      "        mu can have any value, and sigma must be greater than zero.\n",
      "    \n",
      "    normalvariate(mu, sigma) method of Random instance\n",
      "        Normal distribution.\n",
      "        \n",
      "        mu is the mean, and sigma is the standard deviation.\n",
      "    \n",
      "    paretovariate(alpha) method of Random instance\n",
      "        Pareto distribution.  alpha is the shape parameter.\n",
      "    \n",
      "    randint(a, b) method of Random instance\n",
      "        Return random integer in range [a, b], including both end points.\n",
      "    \n",
      "    random() method of Random instance\n",
      "        random() -> x in the interval [0, 1).\n",
      "    \n",
      "    randrange(start, stop=None, step=1, _int=<class 'int'>) method of Random instance\n",
      "        Choose a random item from range(start, stop[, step]).\n",
      "        \n",
      "        This fixes the problem with randint() which includes the\n",
      "        endpoint; in Python this is usually not what you want.\n",
      "    \n",
      "    sample(population, k) method of Random instance\n",
      "        Chooses k unique random elements from a population sequence or set.\n",
      "        \n",
      "        Returns a new list containing elements from the population while\n",
      "        leaving the original population unchanged.  The resulting list is\n",
      "        in selection order so that all sub-slices will also be valid random\n",
      "        samples.  This allows raffle winners (the sample) to be partitioned\n",
      "        into grand prize and second place winners (the subslices).\n",
      "        \n",
      "        Members of the population need not be hashable or unique.  If the\n",
      "        population contains repeats, then each occurrence is a possible\n",
      "        selection in the sample.\n",
      "        \n",
      "        To choose a sample in a range of integers, use range as an argument.\n",
      "        This is especially fast and space efficient for sampling from a\n",
      "        large population:   sample(range(10000000), 60)\n",
      "    \n",
      "    seed(a=None, version=2) method of Random instance\n",
      "        Initialize internal state from hashable object.\n",
      "        \n",
      "        None or no argument seeds from current time or from an operating\n",
      "        system specific randomness source if available.\n",
      "        \n",
      "        If *a* is an int, all bits are used.\n",
      "        \n",
      "        For version 2 (the default), all of the bits are used if *a* is a str,\n",
      "        bytes, or bytearray.  For version 1 (provided for reproducing random\n",
      "        sequences from older versions of Python), the algorithm for str and\n",
      "        bytes generates a narrower range of seeds.\n",
      "    \n",
      "    setstate(state) method of Random instance\n",
      "        Restore internal state from object returned by getstate().\n",
      "    \n",
      "    shuffle(x, random=None) method of Random instance\n",
      "        Shuffle list x in place, and return None.\n",
      "        \n",
      "        Optional argument random is a 0-argument function returning a\n",
      "        random float in [0.0, 1.0); if it is the default None, the\n",
      "        standard random.random will be used.\n",
      "    \n",
      "    triangular(low=0.0, high=1.0, mode=None) method of Random instance\n",
      "        Triangular distribution.\n",
      "        \n",
      "        Continuous distribution bounded by given lower and upper limits,\n",
      "        and having a given mode value in-between.\n",
      "        \n",
      "        http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "    \n",
      "    uniform(a, b) method of Random instance\n",
      "        Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "    \n",
      "    vonmisesvariate(mu, kappa) method of Random instance\n",
      "        Circular data distribution.\n",
      "        \n",
      "        mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "        kappa is the concentration parameter, which must be greater than or\n",
      "        equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "        to a uniform random angle over the range 0 to 2*pi.\n",
      "    \n",
      "    weibullvariate(alpha, beta) method of Random instance\n",
      "        Weibull distribution.\n",
      "        \n",
      "        alpha is the scale parameter and beta is the shape parameter.\n",
      "\n",
      "DATA\n",
      "    __all__ = ['Random', 'seed', 'random', 'uniform', 'randint', 'choice',...\n",
      "\n",
      "FILE\n",
      "    c:\\users\\86136\\anaconda3\\lib\\random.py\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on method randint in module random:\n",
      "\n",
      "randint(a, b) method of random.Random instance\n",
      "    Return random integer in range [a, b], including both end points.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random.randint)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 项目1：奇数中选择指定时间\n",
    "* 课后代码练习一（第1章的代码）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This minute seems a little odd.\n"
     ]
    }
   ],
   "source": [
    "# 情况一：\n",
    "from datetime import datetime\n",
    "\n",
    "odds = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19,\n",
    "        21, 23, 25, 27, 29, 31, 33, 35, 37, 39,\n",
    "        41, 43, 45, 47, 49, 51, 53, 55, 57, 59]\n",
    "\n",
    "right_this__minute = datetime.today().minute\n",
    "\n",
    "if right_this__minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute.\n"
     ]
    }
   ],
   "source": [
    "# 情况二：\n",
    "from datetime import datetime\n",
    "\n",
    "odds = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19,\n",
    "        21, 23, 25, 27, 29, 31, 33, 35, 37, 39,\n",
    "        41, 43, 45, 47, 49, 51, 53, 55, 57, 59]\n",
    "\n",
    "right_this__minute = datetime.today().minute\n",
    "\n",
    "if right_this__minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 项目2：利用Python的\"for\"循环\n",
    "* 课后代码练习二（第1章的代码）\n",
    "* 拓展项目一代码，使得它会运行5次“检查分钟代码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Not an odd minute\n",
      "Not an odd minute\n",
      "This minute seems a little odd.\n",
      "This minute seems a little odd.\n",
      "Not an odd minute\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "import random\n",
    "import time\n",
    "\n",
    "odds = [ 1,  3,  5,  7,  9, 11, 13, 15, 17, 19,\n",
    "        21, 23, 25, 27, 29, 31, 33, 35, 37, 39,\n",
    "        41, 43, 45, 47, 49, 51, 53, 55, 57, 59 ]\n",
    "\n",
    "for i in range(5):\n",
    "    right_this_minute = datetime.today() .minute\n",
    "    if right_this_minute in odds:\n",
    "        print(\"This minute seems a little odd.\")\n",
    "    else:\n",
    "        print(\"Not an odd minute\")\n",
    "        \n",
    "    wait_time = random.randint(1, 60)\n",
    "    time.sleep(wait_time)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 项目3：Head First经典“啤酒歌谣”的Python版本\n",
    "* 课后代码练习三（第1章的代码）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 botttles of beer on the wall.\n",
      "99 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "98 botttles of beer on the wall.\n",
      "\n",
      "98 botttles of beer on the wall.\n",
      "98 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "97 botttles of beer on the wall.\n",
      "\n",
      "97 botttles of beer on the wall.\n",
      "97 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "96 botttles of beer on the wall.\n",
      "\n",
      "96 botttles of beer on the wall.\n",
      "96 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "95 botttles of beer on the wall.\n",
      "\n",
      "95 botttles of beer on the wall.\n",
      "95 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "94 botttles of beer on the wall.\n",
      "\n",
      "94 botttles of beer on the wall.\n",
      "94 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "93 botttles of beer on the wall.\n",
      "\n",
      "93 botttles of beer on the wall.\n",
      "93 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "92 botttles of beer on the wall.\n",
      "\n",
      "92 botttles of beer on the wall.\n",
      "92 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "91 botttles of beer on the wall.\n",
      "\n",
      "91 botttles of beer on the wall.\n",
      "91 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "90 botttles of beer on the wall.\n",
      "\n",
      "90 botttles of beer on the wall.\n",
      "90 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "89 botttles of beer on the wall.\n",
      "\n",
      "89 botttles of beer on the wall.\n",
      "89 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "88 botttles of beer on the wall.\n",
      "\n",
      "88 botttles of beer on the wall.\n",
      "88 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "87 botttles of beer on the wall.\n",
      "\n",
      "87 botttles of beer on the wall.\n",
      "87 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "86 botttles of beer on the wall.\n",
      "\n",
      "86 botttles of beer on the wall.\n",
      "86 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "85 botttles of beer on the wall.\n",
      "\n",
      "85 botttles of beer on the wall.\n",
      "85 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "84 botttles of beer on the wall.\n",
      "\n",
      "84 botttles of beer on the wall.\n",
      "84 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "83 botttles of beer on the wall.\n",
      "\n",
      "83 botttles of beer on the wall.\n",
      "83 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "82 botttles of beer on the wall.\n",
      "\n",
      "82 botttles of beer on the wall.\n",
      "82 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "81 botttles of beer on the wall.\n",
      "\n",
      "81 botttles of beer on the wall.\n",
      "81 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "80 botttles of beer on the wall.\n",
      "\n",
      "80 botttles of beer on the wall.\n",
      "80 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "79 botttles of beer on the wall.\n",
      "\n",
      "79 botttles of beer on the wall.\n",
      "79 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "78 botttles of beer on the wall.\n",
      "\n",
      "78 botttles of beer on the wall.\n",
      "78 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "77 botttles of beer on the wall.\n",
      "\n",
      "77 botttles of beer on the wall.\n",
      "77 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "76 botttles of beer on the wall.\n",
      "\n",
      "76 botttles of beer on the wall.\n",
      "76 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "75 botttles of beer on the wall.\n",
      "\n",
      "75 botttles of beer on the wall.\n",
      "75 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "74 botttles of beer on the wall.\n",
      "\n",
      "74 botttles of beer on the wall.\n",
      "74 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "73 botttles of beer on the wall.\n",
      "\n",
      "73 botttles of beer on the wall.\n",
      "73 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "72 botttles of beer on the wall.\n",
      "\n",
      "72 botttles of beer on the wall.\n",
      "72 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "71 botttles of beer on the wall.\n",
      "\n",
      "71 botttles of beer on the wall.\n",
      "71 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "70 botttles of beer on the wall.\n",
      "\n",
      "70 botttles of beer on the wall.\n",
      "70 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "69 botttles of beer on the wall.\n",
      "\n",
      "69 botttles of beer on the wall.\n",
      "69 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "68 botttles of beer on the wall.\n",
      "\n",
      "68 botttles of beer on the wall.\n",
      "68 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "67 botttles of beer on the wall.\n",
      "\n",
      "67 botttles of beer on the wall.\n",
      "67 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "66 botttles of beer on the wall.\n",
      "\n",
      "66 botttles of beer on the wall.\n",
      "66 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "65 botttles of beer on the wall.\n",
      "\n",
      "65 botttles of beer on the wall.\n",
      "65 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "64 botttles of beer on the wall.\n",
      "\n",
      "64 botttles of beer on the wall.\n",
      "64 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "63 botttles of beer on the wall.\n",
      "\n",
      "63 botttles of beer on the wall.\n",
      "63 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "62 botttles of beer on the wall.\n",
      "\n",
      "62 botttles of beer on the wall.\n",
      "62 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "61 botttles of beer on the wall.\n",
      "\n",
      "61 botttles of beer on the wall.\n",
      "61 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "60 botttles of beer on the wall.\n",
      "\n",
      "60 botttles of beer on the wall.\n",
      "60 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "59 botttles of beer on the wall.\n",
      "\n",
      "59 botttles of beer on the wall.\n",
      "59 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "58 botttles of beer on the wall.\n",
      "\n",
      "58 botttles of beer on the wall.\n",
      "58 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "57 botttles of beer on the wall.\n",
      "\n",
      "57 botttles of beer on the wall.\n",
      "57 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "56 botttles of beer on the wall.\n",
      "\n",
      "56 botttles of beer on the wall.\n",
      "56 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "55 botttles of beer on the wall.\n",
      "\n",
      "55 botttles of beer on the wall.\n",
      "55 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "54 botttles of beer on the wall.\n",
      "\n",
      "54 botttles of beer on the wall.\n",
      "54 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "53 botttles of beer on the wall.\n",
      "\n",
      "53 botttles of beer on the wall.\n",
      "53 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "52 botttles of beer on the wall.\n",
      "\n",
      "52 botttles of beer on the wall.\n",
      "52 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "51 botttles of beer on the wall.\n",
      "\n",
      "51 botttles of beer on the wall.\n",
      "51 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "50 botttles of beer on the wall.\n",
      "\n",
      "50 botttles of beer on the wall.\n",
      "50 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "49 botttles of beer on the wall.\n",
      "\n",
      "49 botttles of beer on the wall.\n",
      "49 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "48 botttles of beer on the wall.\n",
      "\n",
      "48 botttles of beer on the wall.\n",
      "48 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "47 botttles of beer on the wall.\n",
      "\n",
      "47 botttles of beer on the wall.\n",
      "47 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "46 botttles of beer on the wall.\n",
      "\n",
      "46 botttles of beer on the wall.\n",
      "46 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "45 botttles of beer on the wall.\n",
      "\n",
      "45 botttles of beer on the wall.\n",
      "45 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "44 botttles of beer on the wall.\n",
      "\n",
      "44 botttles of beer on the wall.\n",
      "44 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "43 botttles of beer on the wall.\n",
      "\n",
      "43 botttles of beer on the wall.\n",
      "43 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "42 botttles of beer on the wall.\n",
      "\n",
      "42 botttles of beer on the wall.\n",
      "42 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "41 botttles of beer on the wall.\n",
      "\n",
      "41 botttles of beer on the wall.\n",
      "41 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "40 botttles of beer on the wall.\n",
      "\n",
      "40 botttles of beer on the wall.\n",
      "40 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "39 botttles of beer on the wall.\n",
      "\n",
      "39 botttles of beer on the wall.\n",
      "39 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "38 botttles of beer on the wall.\n",
      "\n",
      "38 botttles of beer on the wall.\n",
      "38 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "37 botttles of beer on the wall.\n",
      "\n",
      "37 botttles of beer on the wall.\n",
      "37 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "36 botttles of beer on the wall.\n",
      "\n",
      "36 botttles of beer on the wall.\n",
      "36 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "35 botttles of beer on the wall.\n",
      "\n",
      "35 botttles of beer on the wall.\n",
      "35 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "34 botttles of beer on the wall.\n",
      "\n",
      "34 botttles of beer on the wall.\n",
      "34 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "33 botttles of beer on the wall.\n",
      "\n",
      "33 botttles of beer on the wall.\n",
      "33 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "32 botttles of beer on the wall.\n",
      "\n",
      "32 botttles of beer on the wall.\n",
      "32 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "31 botttles of beer on the wall.\n",
      "\n",
      "31 botttles of beer on the wall.\n",
      "31 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "30 botttles of beer on the wall.\n",
      "\n",
      "30 botttles of beer on the wall.\n",
      "30 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "29 botttles of beer on the wall.\n",
      "\n",
      "29 botttles of beer on the wall.\n",
      "29 botttles of beer.\n",
      "Take one down.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Pass it around.\n",
      "28 botttles of beer on the wall.\n",
      "\n",
      "28 botttles of beer on the wall.\n",
      "28 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "27 botttles of beer on the wall.\n",
      "\n",
      "27 botttles of beer on the wall.\n",
      "27 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "26 botttles of beer on the wall.\n",
      "\n",
      "26 botttles of beer on the wall.\n",
      "26 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "25 botttles of beer on the wall.\n",
      "\n",
      "25 botttles of beer on the wall.\n",
      "25 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "24 botttles of beer on the wall.\n",
      "\n",
      "24 botttles of beer on the wall.\n",
      "24 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "23 botttles of beer on the wall.\n",
      "\n",
      "23 botttles of beer on the wall.\n",
      "23 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "22 botttles of beer on the wall.\n",
      "\n",
      "22 botttles of beer on the wall.\n",
      "22 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "21 botttles of beer on the wall.\n",
      "\n",
      "21 botttles of beer on the wall.\n",
      "21 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "20 botttles of beer on the wall.\n",
      "\n",
      "20 botttles of beer on the wall.\n",
      "20 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "19 botttles of beer on the wall.\n",
      "\n",
      "19 botttles of beer on the wall.\n",
      "19 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "18 botttles of beer on the wall.\n",
      "\n",
      "18 botttles of beer on the wall.\n",
      "18 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "17 botttles of beer on the wall.\n",
      "\n",
      "17 botttles of beer on the wall.\n",
      "17 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "16 botttles of beer on the wall.\n",
      "\n",
      "16 botttles of beer on the wall.\n",
      "16 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "15 botttles of beer on the wall.\n",
      "\n",
      "15 botttles of beer on the wall.\n",
      "15 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "14 botttles of beer on the wall.\n",
      "\n",
      "14 botttles of beer on the wall.\n",
      "14 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "13 botttles of beer on the wall.\n",
      "\n",
      "13 botttles of beer on the wall.\n",
      "13 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "12 botttles of beer on the wall.\n",
      "\n",
      "12 botttles of beer on the wall.\n",
      "12 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "11 botttles of beer on the wall.\n",
      "\n",
      "11 botttles of beer on the wall.\n",
      "11 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "10 botttles of beer on the wall.\n",
      "\n",
      "10 botttles of beer on the wall.\n",
      "10 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "9 botttles of beer on the wall.\n",
      "\n",
      "9 botttles of beer on the wall.\n",
      "9 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "8 botttles of beer on the wall.\n",
      "\n",
      "8 botttles of beer on the wall.\n",
      "8 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "7 botttles of beer on the wall.\n",
      "\n",
      "7 botttles of beer on the wall.\n",
      "7 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "6 botttles of beer on the wall.\n",
      "\n",
      "6 botttles of beer on the wall.\n",
      "6 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "5 botttles of beer on the wall.\n",
      "\n",
      "5 botttles of beer on the wall.\n",
      "5 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "4 botttles of beer on the wall.\n",
      "\n",
      "4 botttles of beer on the wall.\n",
      "4 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "3 botttles of beer on the wall.\n",
      "\n",
      "3 botttles of beer on the wall.\n",
      "3 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "2 botttles of beer on the wall.\n",
      "\n",
      "2 botttles of beer on the wall.\n",
      "2 botttles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "1 bottle of beer on the wall.\n",
      "\n",
      "1 bottle of beer on the wall.\n",
      "1 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "No more bottles of beer of beer on the wall.\n"
     ]
    }
   ],
   "source": [
    "word = \"botttles\"\n",
    "for beer_num in range(99, 0, -1):\n",
    "    print(beer_num, word, \"of beer on the wall.\")\n",
    "    print(beer_num, word, \"of beer.\")\n",
    "    print(\"Take one down.\")\n",
    "    print(\"Pass it around.\")\n",
    "    if beer_num == 1:\n",
    "        print(\"No more bottles of beer of beer on the wall.\")\n",
    "    else:\n",
    "        new_num = beer_num - 1\n",
    "        if new_num == 1:\n",
    "            word = \"bottle\"\n",
    "        print(new_num, word, \"of beer on the wall.\")\n",
    "        print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "256px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
